<?php $this->load->view('inc/header'); ?>

<script type="text/javascript">
$(document).ready(function()
{
	//hide panel blog category
	$(window).load(function ()
	{
		$("#add_blog_category").hide();
		for(var i=0;i<=100;i++){
			$("#update"+i).hide();
		}
	}
	);
	//button toggle blog category
	$("#add_category_but").click(function ()
	{
		$("#add_blog_category").toggle();
	}
	);
}
);

function showUpdate(i)
{	
	$("#update"+i).toggle();
}
</script>
<!--content1-->
<div class="grid_12" style="background-color:#CCCCCC;">
<!--เมนูข้าง-->
<div class="grid_4 alpha" style="margin-top:10px;">
<div id="side-panel-top">
<div style="padding-left: 22px; padding-top: 11px; font-weight: bold;   color:#FF9933; text-shadow: 1px 1px 1px rgb(255, 255, 255);">Management</div>
</div>
<div id="side-panel-middle" style="padding-left: 22px;"><ul id="browser" class="filetree">
<li class="closed"><img src="<?=base_url()?>images/graphic/sitemap-application-blue.png" /> <span>Organization</span>
<ul>
<li>&nbsp;<img src="<?=base_url()?>images/graphic/users.png" /><span> <a href="<?=base_url()?>administrator/org/manage-staff">Manage Staff</a></span></li>
<li>&nbsp;<img src="<?=base_url()?>images/graphic/folder-open-document.png" /><span> <a href="<?=base_url()?>administrator/org/manage-news">Manage Content</a></span></li>
<li>&nbsp;<img src="<?=base_url()?>images/graphic/table-sum.png" /><span> <a href="<?=base_url()?>administrator/org/statistics">Statistics</a></span></li>
</ul>
</li>
<li class="closed"><img src="<?=base_url()?>images/graphic/balloon-twitter-retweet.png" /> <span>CopS</span>
<ul>
<li>&nbsp;<img src="<?=base_url()?>images/graphic/link.png" /><span> Manage Staff</span></li>
<li>&nbsp;<img src="<?=base_url()?>images/graphic/folder-open-document.png" /><span> Manage Content</span></li>
<li>&nbsp;<img src="<?=base_url()?>images/graphic/table-sum.png" /><span> Statistics</span></li>
</ul>
</li>
<li class="closed"><img src="<?=base_url()?>images/graphic/balloon-quotation.png" /> <span>Blogs</span>
<ul>
<li>&nbsp;<img src="<?=base_url()?>images/graphic/link.png" /><span> Manage Staff</span></li>
<li>&nbsp;<img src="<?=base_url()?>images/graphic/folder-open-document.png" /><span> Manage Content</span></li>
<li>&nbsp;<img src="<?=base_url()?>images/graphic/table-sum.png" /><span> Statistics</span></li>
</ul>
</li>
<li class="closed"> this is closed! <img src="<?=base_url()?>images/folder.gif" />
<ul>
<li><img src="<?=base_url()?>images/file.gif" /></li>
</ul>
</li>
<li><img src="<?=base_url()?>images/file.gif" /></li>
</ul></div>
<div id="side-panel-bottom"></div>
<!--เมนูข้าง-->
<div class="grid_4 alpha" style="margin-top:8px;">
<div id="side-panel-top">
<div style="padding-left: 22px; padding-top: 11px; font-weight: bold;   color:#FF9933; text-shadow: 1px 1px 1px rgb(255, 255, 255);">Search</div>
</div>
<div id="side-panel-middle"> dsf</div>
<div id="side-panel-bottom"></div>
</div>
<!--ปิดเมนูข้าง-->
</div>
<!--ปิดเมนูข้าง-->
<div class="grid_8 omega" style="margin-top:10px;">
<div id="km-topic">
	<div style="padding-left: 19px; padding-top: 11px; color: rgb(0, 0, 0); font-weight: bold; text-shadow: 1px 1px 1px rgb(255, 255, 255);">Manage Blog Category</div>
</div>
<div id="km-new-middle" style="height:auto;">
<div id="add_category_but" style="width:580px; cursor:pointer; padding-left:18px;">Add Category<hr/></div>


<div id="list">
	<ol style="padding-left:25px; list-style:none;">
    	<?php 
			$i=0;
			$query = $this->db->get('blog_category');
			foreach($query->result() as $rows)
			{
				$b_category_id = $rows->b_category_id;
				$category_name = $rows->category_name;
				$category_description = $rows->category_description;
				$category_display = $rows->category_display;
				$i++;
		?>
        <!--Category Details-->
          <li style="background-color:#F2F2F2; padding:10px; width:540px;"><img src="<?=base_url()?>images/arrow-bullet.jpg"/>&nbsp;
            <span><?=$category_name?>&nbsp;<span onclick="showUpdate(<?=$i?>)" style="cursor:pointer;"><img src="<?=base_url()?>images/graphic/pencil.png"/></span></span>
            <hr/>
            <div id="organization_desc" style="position:relative; height:auto;">รายละเอียด:&nbsp;(
            <?=$category_description?>
            )
            <div id="category_display" style="position:absolute; right:45px; top:-45px;">
            	<img src="<?=base_url()?>km_resource/blog_category/<?=$category_display?>"/>
            </div>
            
             <div id="update<?=$i?>"><br/><br/><form method="post" action="<?=base_url()?>administrator/edit_blog_category" enctype="multipart/form-data">
            	<label>Category Name: </label><input name="category_name" type="text" id="category_name" size="35" maxlength="100" value="<?=$category_name?>"/>
                <br/><br/>
                <label>Description:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label><input name="category_desc" type="text" id="category_desc" size="50" maxlength="150" value="<?=$category_description?>"/><br/><br/>
                <label>Category icon:&nbsp;&nbsp;&nbsp;</label><input name="image1" id="image1" type="file"/>
                <input type="hidden" name="b_category_id" id="b_category_id" value="<?=$b_category_id?>"/>
                <input type="submit" name="edit_category" id="edit_category" value="Submit" />
            </form>
            </div>
            </div>
          </li>
          <div id="spacer">&nbsp;</div>
          <?php
			} //end foreach
		?>
        <!--Close Category Details-->
        <!-- Add Blog Category -->
        <li id="add_blog_category" style="background-color:#D8F39E; padding:10px; width:540px;"><img src="<?=base_url()?>images/arrow-bullet.jpg"/>&nbsp;Add Category
         <hr/>
            <form method="post" action="<?=base_url()?>administrator/add_blog_category" enctype="multipart/form-data">
            	<label>Category Name: </label><input name="category_name" type="text" id="category_name" size="35" maxlength="100"/>
                <br/><br/>
                <label>Description:&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;</label><input name="category_desc" type="text" id="category_desc" size="50" maxlength="150"/><br/><br/>
                <label>Category icon:&nbsp;&nbsp;&nbsp;</label><input name="image1" id="image1" type="file" />
                <input type="submit" name="add_category" id="add_category" value="Submit" />
            </form>
        </li>
        <!-- Close Blog Category -->
        </ol>
</div>
</div>
<div id="km-new-bottom"></div>
</div>
</div>
<div class="clear"></div>
<!--end content1-->
<div class="grid_12" style="background-color:#CCCCCC;">&nbsp;</div>
<div class="clear"></div>
<?php $this->load->view('inc/footer'); ?>